<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script src="../js/vue.js"></script>
    </head>
    <script>
        // for(let i= 0; i < arr.length; i++){

        // }
        // for(let attr in obj){
        //     obj[attr]
        // }
    </script>
    <body>
        <div id="demo">
            <ul>
                <!-- 数组元素  in  数组 -->
                <!-- <li v-for="todo in todos">{{todo.title}}</li> -->

                <!-- (数组元素,索引)  in  数组 -->
                <!-- <li v-for="(todo, index) in todos">{{index}} - {{todo.title}}</li> -->

                <!-- 没有指定key也不报错，不指定就是用索引作为key -->
                <li v-for="(todo, index) in todos" :key="todo.id">{{index}} - {{todo.title}}</li>
            </ul>
        </div>
        <script>
            Vue.config.productionTip = false
            new Vue({
                el:'#demo',
                data: {
                    todos:[
                        {
                            id:1,
                            title:'吃饭',
                            isDone:false
                        },
                        {
                            id:2,
                            title:'睡觉',
                            isDone:false
                        },
                        {
                            id:3,
                            title:'敲代码',
                            isDone:true
                        }
                    ]
                }
            })
        </script>
    </body>
</html>